<extend name="Public/base" />

<block name="body">
    <div id="indexMain" class="index-main text-center" style="margin: 0px;padding: 0px;text-align: center">
        <div style="width: 94%;margin: auto;padding: 0px;text-align: center" class="text-center input-group form_scor">
            <input type="text" name="title" style="display: inline-block;height: 50px;font-size: 18px;" class="search-input form-control input-large" value="{:I('name')}" placeholder="请输入消耗品名称查看库存">
            <a class="input-group-addon" href="javascript:;" id="search" url="{:U('subpro/subinventory')}&cntstatus=0" style="font-size: 20px;width: 50px;"><i style="font-size: 30px;" class="glyphicon glyphicon-search"></i></a>
        </div>
        <div class="row" style="margin:auto;margin-top: 50px;">
            <div class="col-lg-3 text-center">
                <a  href="{:U('subpro/outadd')}">
                    <span class="glyphicon glyphicon-open " style="font-size: 30px;"  aria-hidden="true"></span>
                    <span>出库</span>
                </a>
                <br/><small><a href="{:U('monthexport')}" >上月总消耗导出</a></small>

            </div>
            <div class="col-lg-3 text-center">
                <a  href="{:U('subpro/inadd')}">
                    <span class="glyphicon glyphicon-save " style="font-size: 30px;"  aria-hidden="true"></span>
                    <span>入库</span>
                </a>
            </div>
            <div class="col-lg-3 text-center">
                <a  href="{:U('subpro/checkflow')}">
                    <span class="glyphicon glyphicon-pencil" style="font-size: 30px;"  aria-hidden="true"></span>
                    <span>盘点</span><br/><small>上次盘点{$pd.checkAt|time_format=###,'Y-m-d'}</small>
                </a>
            </div>
            <div class="col-lg-3 text-center">
                <a href="{:U('subpro/subinventory')}">
                    <span class="glyphicon glyphicon-list" style="font-size: 30px;"  aria-hidden="true"></span>
                    <span>库存</span>
                </a>
            </div>
        </div>
        <div class="row" style="margin:auto;margin-top: 50px;">
            <div class="col-lg-3">
                <dl class="show-num-mod">
                    <dt><i class="count-icon user-count-icon"></i></dt>
                    <dd style="width: 10em;">
                        <strong style="color:red;text-align:center;font-size:22px; ">
                            <span style="font-size:22px;">{$total_price.total_price|number_format}</span>
                        </strong>
                        <span style="text-align:center;">库存总额</span>
                    </dd>
                </dl>
            </div>
            <div class="col-lg-3">
                <dl class="show-num-mod">
                    <dt><i class="count-icon category-count-icon"></i></dt>
                    <dd style="width: 10em;">
                        <strong style="color:red;text-align:center;font-size:22px; ">
                            <span style="font-size:22px;">{$cntstatus.low_cnt}</span>
                        </strong>
                        <span style="text-align:center;">
                            <a href="{:U('subpro/subinventory')}&cntstatus=1">库存不足</a>
                        </span>
                    </dd>
                </dl>
            </div>
            <div class="col-lg-3">
                <dl class="show-num-mod">
                    <dt><i class="count-icon doc-modal-icon"></i></dt>
                    <dd style="width: 10em;">
                        <strong style="color:red;text-align: center;font-size:22px; ">
                            <span style="font-size:22px;">{$cntstatus.poor_cnt}</span>
                        </strong>
                        <span style="text-align:center;">
                            <a href="{:U('subpro/subinventory')}&cntstatus=2">库存偏低</a>
                        </span>
                    </dd>
                </dl>
            </div>
            <div class="col-lg-3">
                <dl class="show-num-mod">
                    <dt><i class="count-icon doc-modal-icon"></i></dt>
                    <dd style="width: 10em;">
                        <strong style="color:red;text-align: center;">
                            <span style="font-size:22px;">{$cntstatus.normal_cnt}</span>
                        </strong>
                        <span style="text-align:center;">
                            <a href="{:U('subpro/subinventory')}&cntstatus=2">库存正常</a>
                        </span>
                    </dd>
                </dl>
            </div>
        </div>
        <div class="row" style="margin:auto;margin-top: 50px;">
            <div class="col-lg-3">
                <dl class="show-num-mod">
                    <dt><i class="count-icon doc-count-icon"></i></dt>
                    <dd style="width: 10em">
                        <strong style="color:red">{$xiaohao.yescnt|number_format}</strong>
                        <span>昨日消耗</span>
                    </dd>
                </dl>
            </div>
            <div class="col-lg-3">
                <dl class="show-num-mod">
                    <dt><i class="count-icon doc-count-icon"></i></dt>
                    <dd style="width: 10em">
                        <strong style="color:red">{$xiaohao.sevencnt|number_format}</strong>
                        <span>7日平均消耗</span>
                    </dd>
                </dl>
            </div>
            <div class="col-lg-3">
                <dl class="show-num-mod">
                    <dt><i class="count-icon doc-count-icon"></i></dt>
                    <dd style="width: 8em">
                        <strong style="color:red">{$xiaohao.halfmonthcnt|number_format}</strong>
                        <span>15日平均消耗</span>
                    </dd>
                </dl>
            </div>
            <div class="col-lg-3">
                <dl class="show-num-mod">
                    <dt><i class="count-icon doc-count-icon"></i></dt>
                    <dd style="width: 8em">
                        <strong style="color:red">{$xiaohao.monthcnt|number_format}</strong>
                        <span>30日平均消耗</span>
                    </dd>
                </dl>
            </div>
        </div>
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        $("#search").click(function(){
            var url = $(this).attr('url');
            var query  = $('.form_scor').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function(e){
            if(e.keyCode === 13){
                $("#search").click();
                return false;
            }
        });
    </script>
</block>
